﻿package mortal.game.view.task.view.track
{
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class BtnShowTrackModule extends GSprite
    {
        private var _btn1:GLoadedButton;
        private var _btn2:GLoadedButton;
        private var _status:int;

        public function BtnShowTrackModule()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            buttonMode = true;
            this._btn1 = UIFactory.gLoadedButton(ImagesConst.UpButton_upSkin, 0, 0, 18, 18, this);
            this._btn1.toolTipData = HTMLUtil.addColor(Language.getString(20141), "#ffffff");
            this._btn2 = UIFactory.gLoadedButton(ImagesConst.DownButton_upSkin, 0, 0, 18, 18, this);
            this._btn2.toolTipData = HTMLUtil.addColor(Language.getString(20142), "#ffffff");
            configEventListener(MouseEvent.CLICK, this.onMouseClick);
            this.open();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._btn1.dispose(param1);
            this._btn1 = null;
            this._btn2.dispose(param1);
            this._btn2 = null;
            return;
        }// end function

        public function open() : void
        {
            if (this._btn2.parent)
            {
                removeChild(this._btn2);
            }
            if (!this._btn1.parent)
            {
                addChild(this._btn1);
            }
            this._status = -1;
            return;
        }// end function

        public function close() : void
        {
            if (this._btn1.parent)
            {
                removeChild(this._btn1);
            }
            if (!this._btn2.parent)
            {
                addChild(this._btn2);
            }
            this._status = 1;
            return;
        }// end function

        private function onMouseClick(event:MouseEvent) : void
        {
            if (this._status == 1)
            {
                this.open();
            }
            else
            {
                this.close();
            }
            return;
        }// end function

        public function get isClose() : Boolean
        {
            return this._status == 1;
        }// end function

        override public function set width(param1:Number) : void
        {
            super.width = param1;
            this._btn2.width = param1;
            this._btn1.width = param1;
            return;
        }// end function

        override public function set height(param1:Number) : void
        {
            super.height = param1;
            this._btn2.height = param1;
            this._btn1.height = param1;
            return;
        }// end function

    }
}
